package com.css.zfzx.fxpg.modules.attach;

import com.css.bpm.platform.components.attach.repository.entity.SysAttachmentEntity;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @author leon
 * @Title: 文件
 * @Description:
 * @date 2020/11/23 10:04
 */
@Repository
public interface FxAttachmentRepository extends JpaRepository<SysAttachmentEntity, String> {

    /**
     * 根据文件名称和有效值查询附件表
     *
     * @param attachName
     * @param isValid    1为有效
     * @return
     */
    @Query(
            nativeQuery = true,
            value = "select * from sys_attachment_info where attach_name = :attachName and is_valid = :isValid"
    )
    List<SysAttachmentEntity> findByAttachNameAndIsValid(@Param("attachName") String attachName, @Param("isValid") String isValid);

}
